<template>
    <section>
        <!--工具条-->
        <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
            <el-form :inline="true" :model="filters">
                <el-form-item>
                    <el-input v-model="filters.name" placeholder="姓名"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-on:click="getRoleList">查询</el-button>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-on:click="addMember">新增</el-button>
                </el-form-item>
            </el-form>
        </el-col>

        <!--列表-->
        <el-table :data="memberList" highlight-current-row v-loading="listLoading" style="width: 100%;">

            <el-table-column prop="name" label="角色名称" width="120">
            </el-table-column>



            <el-table-column label="创建时间" min-width="180" prop='createTime' :formatter="fmtDate">

            </el-table-column>
            <el-table-column label="操作" width="80">
                <template scope="scope">
                    <el-button size="small" @click="toSaveRole(scope.$index, scope.row)">编辑</el-button>

                </template>
            </el-table-column>
        </el-table>

        <!--工具条-->
        <el-col :span="24" class="toolbar">

            <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="10" :total="total" style="float:right;">
            </el-pagination>
        </el-col>

        <!--编辑界面-->
        <el-dialog title="编辑角色信息    " v-model="ShowSave" :close-on-click-modal="false">
            <el-form label-width="80px" >
                <el-form-item label="角色名" prop="name">
                    <el-input v-model="currObj.name" auto-complete="off"></el-input>
                </el-form-item>

                <el-form-item label="备注">
                    <el-input type="textarea" v-model="currObj.memo"></el-input>
                </el-form-item>
                <el-form-item label="菜单">
                    <el-tree :data="data2" show-checkbox node-key="id" :check-strictly='true' ref="menuTree" :default-expanded-keys="[2, 3]"
                        :default-checked-keys="[5]" :props="defaultProps" lable="name">
                    </el-tree>
                </el-form-item>
                <el-form-item label="权限">
                    <el-checkbox-group v-model="currObj.powerIdArray">
                        <el-checkbox v-for="power in getPowerList()" :label="power.name"></el-checkbox>
                    </el-checkbox-group>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click.native="ShowSave = false">取消</el-button>
                <el-button type="primary" @click.native="saveRole" :loading="editLoading">提交</el-button>
            </div>
        </el-dialog>



    </section>
</template>
<script src="./roleList.js"></script>

<style lang="scss" scoped>

</style>